<!-- 设置 -->
<template>
	<view class="page">
		<view class="card flex flex-wrap">
			<view class="item flex justify-between align-center" @click="account">
				<view class="name">
					账号设置
				</view>
				<view class="icons flex justify-center align-center">
					<image src="https://sanfuzhide.oss-cn-hangzhou.aliyuncs.com/my/youbiao.png" mode=""></image>
				</view>
			</view>
			<view class="item flex justify-between align-center" @click="flower">
				<view class="name">
					我的花名
				</view>
				<view class="right flex justify-center align-center">
					<text>{{item.flowerName}}</text>
					<text v-if="!item.flowerName">未填写</text>
					<view class="icon flex justify-center align-center">
						<image src="https://sanfuzhide.oss-cn-hangzhou.aliyuncs.com/my/youbiao.png" mode=""></image>
					</view>
				</view>
			</view>
		</view>
		<view style="height: 30rpx; width: 100%;">
			
		</view>
		<view class="card flex flex-wrap">
			<view class="item flex justify-between align-center" @click="blacklist">
				<view class="name">
					我的黑名单
				</view>
				<view class="icons flex justify-center align-center">
					<image src="https://sanfuzhide.oss-cn-hangzhou.aliyuncs.com/my/youbiao.png" mode=""></image>
				</view>
			</view>
			<view class="item flex justify-between align-center" @click="privacy">
				<view class="name">
					隐私设置
				</view>
				<view class="icons flex justify-center align-center">
					<image src="https://sanfuzhide.oss-cn-hangzhou.aliyuncs.com/my/youbiao.png" mode=""></image>
				</view>
			</view>
		</view>
		<Flower :show='show&&item.type==1' @func="getshow" status="statu" @cancel="cancel" :flowerr="flowerr"></Flower>
	</view>
</template>

<script>
	import Flower from '@/components/flower/flower.vue'
	export default {
		components:{
			Flower
		},
		data() {
			return {
				show: false,
				item:{},
				statu:0,
				flowerr:''
			}
		},
		onLoad() {
			this.getData()
		},
		methods: {
			//请求数据
			async getData() {
				let {
					data: item
				} = await this.$get('/user/UserInfo')
				this.item = item
				console.log(item)
				if(item.flowerName.length == 0){
					this.statu = 0
				}else{
					this.statu = 1
					this.flowerr = item.flowerName
					console.log(this.flowerr)
				}
			},
			//账号设置
			account(){
				uni.navigateTo({
					url: '/pagesB/accountSet/accountSet'
				})
			},
			//我的花名
			flower(){
				this.show = true
			},
			//关闭弹框
			cancel(){
				this.show = false
			},
			//接收子组件的show
			getshow(e){
				this.show = false
				this.getData()
			},
			//我的黑名单
			blacklist(){
				uni.navigateTo({
					url:'/pagesA/blacklist/blacklist'
				})
			},
			//隐私设置
			privacy(){
				uni.navigateTo({
					url: '/pagesA/privacy/privacy'
				})
			}
		}
	}
</script>

<style lang="scss">
.page{
	background: #f5f5f5;
	min-height: 100vh;
	padding: 30rpx;
	.card{
		height: 240rpx;
		background: #FFFFFF;
		border-radius: 24rpx;
		.item{
			height: 50%;
			width: 100%;
			padding: 0 30rpx;
			.name{
				font-weight: 500;
				color: #333333;
				font-size: 32rpx;
			}
			.icons{
				width: 11rpx;
				height: 21rpx;
			}
			.right{
				.icon{
					width: 11rpx;
					height: 21rpx;
				}
				text{
					font-weight: 500;
					color: #999999;
					font-size: 24rpx;
					margin-right: 20rpx;
				}
			}
		}
	}
}
</style>
